# -*- coding: utf-8 -*-
# @Time : 2023/11/4 13:04
# @Author : cute
# @Email : Aggressive_cute@126.com
import requests
data = {
    "appId": "1604ebb2287",
    "e": "JH2RO2R2NKRSWVJ5QE5QFI253GHHLZW6EJEDSJRQYKEIFXPF6EMJBLSNHMIYPDLOUI4CSQVSNHPGXW4RCIOV7OKF5U",
}
url = "http://120.46.138.249/:9888/cute_api/jd_api/slide"
response = requests.post(url, json=data)
print(response.text)

exit()
from loguru import logger
### get_h5st
# data_dict = {
#     'global_this': {
#         "_version": "4.1",
#         "_appId": "73806",
#         "_fingerprint": "6693n5mig6zggz66",
#         "_token": "tk03wb1151c7d18no746KhinpIH8Oz3zI_HQUKcxrvmEQmI1kLbeWKjFSxfSCHRRADZyyY37X_WemgvOw16kn1KnD7bt",
#     },
#     '_stk': '',
#     'keyword': '',
# }
#
#
# url = "http://127.0.0.1:8080/cute_api/jd_api/get_h5st"
# response = requests.post(url, json=data_dict)
# print(response.json())

### generateAksParams
# data_dict = {
#     'global_this': {
#         "_version": "4.1",
#         "_appId": "73806",
#         "_fingerprint": "6693n5mig6zggz66",
#         "_token": "tk03wb1151c7d18no746KhinpIH8Oz3zI_HQUKcxrvmEQmI1kLbeWKjFSxfSCHRRADZyyY37X_WemgvOw16kn1KnD7bt",
#     },
#     '_stk': '',
#     'keyword': '',
# }
# url = "http://127.0.0.1:8080/cute_api/jd_api/generateAksParams"
# response = requests.post(url, json=data_dict)
# print(response.json())

# h5st最新版4.3测试
import time
import requests
def dumps(data_dict):
    """
    字典数据序列化
    :return:
    """
    import json
    return json.dumps(data_dict, separators=(',', ':'))
params = {
        "appid": "pc-item-soa",
        "body": dumps(
            {"skuId": 100078020150, "cat": "9987,653,655", "area": "15_1213_3038_59931", "shopId": "1000004123",
             "venderId": 1000004123,
             "paramJson": dumps(
                 {"platform2": "1", "specialAttrStr": "p0pppppppp2pp1p1pppppppppppppp", "skuMarkStr": "00"}),
             "num": 1,
             "bbTraffic": "",
             "canvasType": 1}),
        "client": "pc",
        "clientVersion": "1.0.0",
        "functionId": "pc_detailpage_wareBusiness",
        "t": int(time.time() * 1e3),
    }
# url = "http://127.0.0.1:9000/cute_api/jd_api/get_h5st_now"
url = "http://203.57.239.243:9000/cute_api/jd_api/get_h5st_now"
response = requests.post(url, json=params)
h5st = response.json()['data']['h5st_now']
logger.info('h5st: %s'%(h5st))

headers = {
    "authority": "api.m.jd.com",
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "zh-CN,zh;q=0.9",
    "cache-control": "no-cache",
    "origin": "https://item.jd.com",
    "pragma": "no-cache",
    "referer": "https://item.jd.com/",
    "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
    "x-referer-page": "https://item.jd.com/100078020150.html",
    "x-rp-client": "h5_1.0.0"
}
cookies = {
    "shshshfpa": "5b2a8a72-6722-d811-b23d-4d0c377c788a-1703072160",
    "shshshfpx": "5b2a8a72-6722-d811-b23d-4d0c377c788a-1703072160",
    "__jdu": "17030721601201214031030",
    "TrackID": "1iE_UEigB4ILnYN4eGFcwdN-eR7I9IaGVrUtOUOtQdV9Zt1Y7Uyd3Q6VpJ0363qVPocZUS0u80hKqOTkyWQ7pKaq41gp2zyJ8_WwWiYsFYaixHvMwNqMKiU_z1KhPBec4",
    "thor": "535CF7E2F9DA3300484562302834CC48DA9E292B6470B218EB4522B624C0D8CA8435CCB17E4C017C6AEFE49600FA6C187232911B830BE4B3F7304D1BE55E5BF3EF71B3E655A33C922E6944CE4F9BC796824DEDD5B3F75385DD946A00FAD9560278964DA6EA014CEEC264C30971817C5B1FD069FF17FF38B0D3A0CE3A997CFBC59E9077CB177EEF9F5B7EED2BB5871F90B037BA7244B026F9244CDF10E05DB217",
    "flash": "2_aDcTrJsPV4F1_ieo4jiYuda3UcLNXQ3ALHzSopSzNo1x0uFIQ7OgyY6lvzHyV8N3bnJYaaf7_3NQlRlftYOOVb8t4TAM2CptsU6aAgQ9O-q*",
    "pinId": "VRPkdxsSV8eGYEG9t31I37V9-x-f3wj7",
    "pin": "jd_6cc2cec972b5b",
    "unick": "jd_6cc2cec972b5b",
    "ceshi3.com": "000",
    "_tp": "OxRjWkxGGlvSIQqfOjUCLiYzl0EcDaIWdQlkXSaBYC8%3D",
    "_pst": "jd_6cc2cec972b5b",
    "user-key": "88c301ea-d486-41d3-8a97-9495166c4cd1",
    "cn": "0",
    "unpl": "JF8EALRnNSttC09cUk4EHBtEHFhTW1gLHEQHb2RVU1VbTgAMTAFIEhJ7XlVdWBRKFx9vbhRUXFNPUg4ZCisSEXteU11bD00VB2xXVgQFDQ8WUUtBSUt-SVhVW1wNShMHZ2IDZG1bS2QFGjIbFBFJXFJdXQ9KFwBuZwZUWFlJVAQZAysTIExtZG5fAUgfAmxXBGRcaAkAWR0FHBEZTRBUWFwKShEAb2AEVF5ZS1cFHgMZEhFJXGRfbQs",
    "__jdv": "229668127|baidu-search|t_262767352_baidusearch|cpc|340404055947_0_b59fd768ef46442fb512a6924e8f2b13|1705546661455",
    "mt_xid": "V2_52007VwMUU19ZVFkfThhcBmYDEVJYWVBaHksYbARjV0cHWFpXRkxPHgkZYlBFBkFRAF4YVRsIVzVURlUKUFVeSnkaXQZiHxNSQVhbSx9JElwHbAMVYl9oUWocSB9UAGIzEVVdXg%3D%3D",
    "jsavif": "1",
    "areaId": "15",
    "ipLoc-djd": "15-1213-3038-59931",
    "3AB9D23F7A4B3C9B": "UEXXAZQ73WBZTLJDKJDAMIU7MJ3SQC4HYU2PUTMI3F72K63MREA6XXCDNLBMIOAM3N5Y7AJT7EBRUN3MAZ45CL4L3A",
    "__jda": "181111935.17030721601201214031030.1703072160.1705546661.1705901828.5",
    "__jdc": "181111935",
    "mba_muid": "17030721601201214031030",
    "__jd_ref_cls": "LoginDisposition_Refresh",
    "token": "7416f178e128759834d917ffd85fdd92,3,947727",
    "__tk": "51d52511e5d90d89f3195fae6a66cc11,3,947727",
    "shshshsID": "298de7c37a0ab9a9530a4cbf43fa0696_14_1705909490781",
    "3AB9D23F7A4B3CSS": "jdd03UEXXAZQ73WBZTLJDKJDAMIU7MJ3SQC4HYU2PUTMI3F72K63MREA6XXCDNLBMIOAM3N5Y7AJT7EBRUN3MAZ45CL4L3AAAAAMNGAQRJWIAAAAADUOW6QDONLW4JQX",
    "_gia_d": "1",
    "__jdb": "181111935.29.17030721601201214031030|5.1705901828",
    "shshshfpb": "BApXemYApM-hA3CRilWU2pQD0JHuMuslQBkFGJk9J9xJ1Mv83s4O2"
}
url = "https://api.m.jd.com/"
params.update({
    'h5st': h5st,
    "x-api-eid-token": "jdd03UEXXAZQ73WBZTLJDKJDAMIU7MJ3SQC4HYU2PUTMI3F72K63MREA6XXCDNLBMIOAM3N5Y7AJT7EBRUN3MAZ45CL4L3AAAAAMNGAQRJWIAAAAADUOW6QDONLW4JQX",
    "loginType": "3",
    "scval": "100078020150",
    "uuid": "181111935.17030721601201214031030.1703072160.1705546661.1705901828.5"
})

response = requests.get(url, headers=headers, cookies=cookies, params=params)
logger.info('==> %s' % (response.text))